Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

log: Set content type header for http sink #77014

Merged
merged 1 commit into from
Feb 25, 2022

Conversation

rimadeodhar
Copy link
Collaborator

The content type header for the output of HTTP log sink
is always set to text/plain irrespective of the log format.
If the log format is JSON, we should set the content
type to be application/json.

Release note (bug fix): The content type header for the
HTTP log sink is set to application/json if the format of
the log output is JSON.

The content type header for the output of HTTP log sink
is always set to text/plain irrespective of the log format.
If the log format is JSON, we should set the content
type to be application/json.

Release note (bug fix): The content type header for the
HTTP log sink is set to application/json if the format of
the log output is JSON.
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@rimadeodhar rimadeodhar requested review from knz, cameronnunez and a team February 24, 2022 22:32
Copy link
Collaborator

@dhartunian dhartunian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 2 of 5 files at r1, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @cameronnunez and @knz)

@rimadeodhar
Copy link
Collaborator Author

TFTR!

bors r=dhartunian

@craig craig bot merged commit 2826900 into cockroachdb:master Feb 25, 2022
@craig
Copy link
Contributor

craig bot commented Feb 25, 2022

Build succeeded:

@blathers-crl
Copy link

blathers-crl bot commented Feb 25, 2022

Encountered an error creating backports. Some common things that can go wrong:

  1. The backport branch might have already existed.
  2. There was a merge conflict.
  3. The backport branch contained merge commits.

You might need to create your backport manually using the backport tool.


error creating merge commit from 65c59a6 to blathers/backport-release-21.2-77014: POST https://api.github.com/repos/cockroachlabs/cockroach/merges: 403 Resource not accessible by integration []

you may need to manually resolve merge conflicts with the backport tool.

Backport to branch 21.2.x failed. See errors above.


🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is otan.

knz added a commit to knz/cockroach that referenced this pull request Mar 1, 2022
This is a fixup to cockroachdb#77014:

- the content-type is not a property of the format *parser*, it's a
  property of the format itself. Touching `formatParsers` to compute
  it is an abstraction mismatch.

- the content-type is constant for a given log config. There's no
  need to re-compute it on every log entry. It can be computed
  and stored once when the config is applied in `flags.go`.

  (Also, the `outputLogEntry` code is time-sensitive, so we don't want
  to give it more work.)

- the content-type is only needed for HTTP sinks. No need
  to compute it for other sink types. So its retrieval can be
  confined to `newHTTPSink`.

Release justification: bug fix

Release note: None
@knz
Copy link
Contributor

knz commented Mar 1, 2022

please backport together with #77210

craig bot pushed a commit that referenced this pull request Mar 3, 2022
77210: util/log: only compute content-type once r=rimadeodhar a=knz

This is a fixup to #77014:

- the content-type is not a property of the format *parser*, it's a
  property of the format itself. Touching `formatParsers` to compute
  it is an abstraction mismatch.

- the content-type is constant for a given log config. There's no
  need to re-compute it on every log entry. It can be computed
  and stored once when the config is applied in `flags.go`.

  (Also, the `outputLogEntry` code is time-sensitive, so we don't want
  to give it more work.)

- the content-type is only needed for HTTP sinks. No need
  to compute it for other sink types. So its retrieval can be
  confined to `newHTTPSink`.

Release justification: bug fix

Release note: None

Co-authored-by: Raphael 'kena' Poss <[email protected]>
rimadeodhar pushed a commit to rimadeodhar/cockroach that referenced this pull request Mar 3, 2022
This is a fixup to cockroachdb#77014:

- the content-type is not a property of the format *parser*, it's a
  property of the format itself. Touching `formatParsers` to compute
  it is an abstraction mismatch.

- the content-type is constant for a given log config. There's no
  need to re-compute it on every log entry. It can be computed
  and stored once when the config is applied in `flags.go`.

  (Also, the `outputLogEntry` code is time-sensitive, so we don't want
  to give it more work.)

- the content-type is only needed for HTTP sinks. No need
  to compute it for other sink types. So its retrieval can be
  confined to `newHTTPSink`.

Release justification: bug fix

Release note: None
koorosh pushed a commit to koorosh/cockroach that referenced this pull request Mar 5, 2022
This is a fixup to cockroachdb#77014:

- the content-type is not a property of the format *parser*, it's a
  property of the format itself. Touching `formatParsers` to compute
  it is an abstraction mismatch.

- the content-type is constant for a given log config. There's no
  need to re-compute it on every log entry. It can be computed
  and stored once when the config is applied in `flags.go`.

  (Also, the `outputLogEntry` code is time-sensitive, so we don't want
  to give it more work.)

- the content-type is only needed for HTTP sinks. No need
  to compute it for other sink types. So its retrieval can be
  confined to `newHTTPSink`.

Release justification: bug fix

Release note: None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants